package codeine.configuration.directory;

import java.util.List;

import com.google.common.collect.Lists;

public class PeerStatusJson {

	private String host;
	private int port;
	private String version;
	private String tar;
	private long start_time;
	private long update_time;//was: updated in directory server
	private String install_dir;
	private List<DiscoveredProjectJson> projects = Lists.newArrayList();
	
	public PeerStatusJson(){
		
	}
	public PeerStatusJson(String host, int port, String version, long start_time, String install_dir, List<DiscoveredProjectJson> projects, String tar, long update_time) {
		super();
		this.host = host;
		this.port = port;
		this.version = version;
		this.start_time = start_time;
		this.install_dir = install_dir;
		this.projects = projects;
		this.tar = tar;
		this.update_time = update_time;
	}

	
	@Override
	public String toString() {
		return "PeerStatusJson [host=" + host + ", port=" + port + ", version=" + version + ", tar=" + tar
				+ ", start_time=" + start_time + ", update_time=" + update_time + ", install_dir=" + install_dir
				+ ", projects=" + projects + "]";
	}
	
	public int port() {
		return port;
	}

	public String host() {
		return host;
	}

	public String version() {
		return version;
	}

	public void update_time(long update_time) {
		this.update_time = update_time;
	}

	public String install_dir() {
		return install_dir;
	}

	public List<DiscoveredProjectJson> projects() {
		return projects;
	}
	public String tar() {
		return tar;
	}
	public long update_time() {
		return update_time;
	}
	
	public String key(){
		return host() + ":" + install_dir();
	}
	
}
